﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SOA.DAL
{
    public class PlanoEntrega
    {
        public bool Criar(SOA.MODEL.PlanoEntrega p)
        {            
            var sqlInsert = "INSERT INTO TB_PLANO_ENTREGA (ID_FILIAL,DATA,QTDE_HOT_DOG_1, QTDE_HOT_DOG_2, QTDE_REFRI_1,QTDE_REFRI_2, DATA_ENTREGA) " +
            "VALUES (";
            sqlInsert += p.IdFilial + ",";
            sqlInsert += "'" + p.Data.ToString("MM/dd/yyyy") + "',";            
            sqlInsert += p.QtdeHotDog1 + ",";
            sqlInsert += p.QtdeHotDog2 + ",";
            sqlInsert += p.QtdeRefri1 + ",";
            sqlInsert += p.QtdeRefri2 + ",";
            sqlInsert += "'" + p.Data.AddDays(1).ToString("MM/dd/yyyy") + "')";            
            return new Db().Execute(sqlInsert) > 0;
            
        }
    }
}